
$ajax({
    method:'get',
    url:"http://cloud-music.pl-fe.cn/personalized?limit=23",
    success: function(e){
         if(e.code === 200){
        //  获取接口数据并渲染上页面
          let data = e.result;
          let str = '';
          const SwiperWrapper = document.querySelector('.swiper-wrapper');
          const Opic = SwiperWrapper.getElementsByClassName('sec-con-pic');
          const OswiperSlide = SwiperWrapper.getElementsByClassName("swiper-slide")
          data.forEach(function(item,index){{
               str+= `
               <div class="swiper-slide">
               <div class="sec-con-box">
                 <a href="" class="section-content-links">
                   <img src="${item.picUrl}" alt="" class="sec-con-pic" />
                   <i class="icon-bg"></i>
                 </a>
               </div>
               <div class="sec-con-text">
                 <h3 class="sec-con-title">
                   <a href="#" class="sec-con-title-link" title="${item.name}">${item.name}</a>
                 </h3>
                 <p class="sec-con-desc">
                   播放量：<span class="colorlevel3">${item.playCount}</span>
                 </p>
               </div>
             </div>  
              `
          }})
          SwiperWrapper.innerHTML = str;
        //   OswiperSlide.style.width = "calc((100% - 20px * 4) / 5)";
    
        // 在过获取接口数据后获取swiper数据
            new Swiper ('.swiper', {
            // direction: 'vertical', // 垂直切换选项
            loop: true, // 循环模式选项
            
            // 如果需要分页器
            pagination: {
              el: '.swiper-pagination',
            },
            
            // 如果需要前进后退按钮
            navigation: {
              nextEl: '.swiper-button-next',
              prevEl: '.swiper-button-prev',
            },
            
          }) 
         }
    }
})




  console.log(1);
   $ajax({
     method:"get",
     url:"http://cloud-music.pl-fe.cn/personalized",
     success: function(e){
        if(e.code == 200){
           console.log(e);
           
        }
     }
   }) 



